package com.example.web1.web;

import com.example.web1.dao.User2;
import com.example.web1.entity.conUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
@RequestMapping("index1")
@Controller
public class Index2 {

    @Autowired
    User2 user2;
    @RequestMapping("list1")
    @ResponseBody
    public List<conUser> list1() {
        List<conUser> list1 = user2.list1();
        return list1;
    }

    @RequestMapping("indexhtml1")
    public String listhtml1(ModelMap map) {
        List<conUser> list1 = user2.list1();
        map.put("userList1", list1);
        for (conUser user2 : list1) {
            System.out.println(user2.getContinent());
            System.out.println(user2.getEnglish());
            System.out.println(user2.getAmount());
        }
        return "index";
    }
}
